<?PHP
/* Generieke definitie file */
include_once '/defs/constants.php';
include_once '/defs/db_constants.php';

//require ('connect.php');

/* Taal specifieke tekst */

include_once DIR_LANGUAGE.'nl/ticketsysteem.php';
include_once DIR_CLASS.'ticketsysteem_location.php';

include_once DIR_CLASS.FILE_TICKETSYSTEEM;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
       <!-- include the Tools -->
  <script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style_admin.css" rel="stylesheet" type="text/css" />
<title>MinEvents - Ticketformulier</title>
</head>
<script type="text/javascript">
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is vereist.\n'; }
    } if (errors) alert('De volgende problemen zijn gevonden\n'+errors);
    document.MM_returnValue = (errors == '');
} }
</script>
<body>
<!-- begin wrapper_achtergrond -->	<div class="wrapper_achtergrond">
<!-- begin wrapper--> 				<div class="wrapper">

<!-- begin header-->				<div class="header">

<!-- begin header_logo-->			<div class="header_logo">
<!-- einde header_logo-->			</div>


<!-- begin header_menu-->			<div class="header_menu">

<!-- begin header_instellingen-->	<div class="header_instellingen">
									<a href="#"><img src="images/instellingen.png" /></a>
<!-- einde header_instellingen-->	</div>

<!-- begin header_instellingen-->	<div class="header_FAQ">
									<a href="#"><img src="images/faq.png" /></a>
<!-- einde header_instellingen-->	</div>

<!-- begin header_instellingen-->	<div class="header_uitloggen">
									<a href="#"><img src="images/uitloggen.png" /></a>
<!-- einde header_instellingen-->	</div>

<!-- einde header_menu-->			</div>s

<!-- einde header-->				</div>

									<div class="sidebar">

									<div class="home_button">
                                    <a href="../index.php"><img src="images/home_button.png" /></a>
                                    </div>

									<div class="kleine_button_1">
                                    <div class="kleine_button_1_titel"><a href="Ticketformulier_Admin.php">Ticketformulier</a></div>
									</div>
                                    

									<div class="kleine_button_2">
                                    <div class="kleine_button_2_titel"><a href="Ticketoverzicht_Admin.php">Ticketoverzicht</a></div>
									</div>

									<div class="kleine_button_3">
                                    <div class="kleine_button_3_titel"><a href="EigenTickets_Admin.html">Eigen tickets</a></div>
									</div>
                                    
                                    </div>

<div class="content">
    <?php
 
       
  
  
        ?>
<font size="+2"> Ticketformulier </font>
<br /><br />
<table width="350" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><form action="" method="post" name="form1" id="myform" action="#">
        <div id="input" />
<table width="350" border="0" cellpadding="0" cellspacing="5" onfocus="MM_validateForm('afdeling','','R','Titel','','R','Beschrijving','','R');return document.MM_returnValue"> 
<tr>
<td width="105">Afdeling</td>




<td width="16">:</td>
<td width="222">
   <select name="afdeling">
                   <?php
    $query = "SELECT * FROM afdeling ORDER BY afdeling_naam ASC";
    $result = mysql_query($query) or die(mysql_error());
    
    while ($loop = mysql_fetch_assoc($result)) 
    { 
        $afdeling_id = $loop['afdeling_id'];
    $afdeling_naam = $loop['afdeling_naam'];

        
    $aantal = mysql_num_rows($result);

    
        if ($aantal == '0') {
        echo "Er staat niets in de database";
        } else     {
?>
                  
                 
                        <option value="<?php echo$loop['afdeling_naam'];?>"><?php echo$loop['afdeling_naam'];?></option>

                    <?php
                }
        }
                    ?>
                             </select>

* </td>
</tr>
    
<tr>
<td width="105">Object</td>
<td width="16">:</td>
<td width="222">
    <select name="" id="">


</select>

* </td>
</tr>
    
<tr>
<td><label for="Titel">Titel</label></td>
<td>:</td>
<td><input name="Titel" type="text" id="Titel" title="Dit is een test" maxlength="64">*</input> 
</td>
</tr>
<tr>
<td>Beschrijving </td>
<td>:</td>
<td><textarea name="Beschrijving" id="Beschrijving"></textarea> 
* </td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
<td><input name="Verzenden" type="submit" value="Verzenden" onclick="MM_validateForm('Afdeling','','R','Titel','','R','Beschrijving','','R');return document.MM_returnValue"></input>
</td>
</tr>
</table>
<?PHP
if(isset($_POST['Verzenden'])) {

$loc_name = $_POST['afdeling'];
$title = $_POST['Titel'];
$desc = $_POST['Beschrijving'];

        $ticketsysteem = new TicketSysteem();
        
        $ticketsysteem->setAfdeling($loc_name);
        $ticketsysteem->setStatusId('1');
        $ticketsysteem->setTitle($title);
        $ticketsysteem->setDesc($desc);
        $ticketsysteem->setProg('progress');
        $ticketsysteem->setEndTime(1);
        $ticketsysteem->setPrioId('3');
         $ticketsysteem->saveTicket();
   
        echo "uw ticket is opgeslagen, u vulde in: " . "<br>";
        echo "Afdeling: " . ($loc_name) . "<br>";
        echo "Ticket Titel: " . ($title) . "<br>";
        echo "Ticket Beschrijving: " . ($desc) . "<br>";
}
?>
</form></td>
</tr>
</table>
</div>



<!-- javascript coding -->
<script>
  // execute your scripts when the DOM is ready. this is a good habit
  $(function() {

        // select all desired input fields and attach tooltips to them
      $("#myform :input").tooltip({

      // place tooltip on the right edge
      position: "center right",

      // a little tweaking of the position
      offset: [-2, 10],

      // use the built-in fadeIn/fadeOut effect
      effect: "fade",

      // custom opacity setting
      opacity: 0.7

      });
    });
</script>

</div>




<div class="footer">
Realisatie: Stichting Innovision Solutions
</div>
<!-- einde footer -->				</div>
<!-- einde wrapper -->				</div>

</body>
</html>
